﻿namespace MTSLauncher
{
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Reflection;
    using System.Windows.Forms;

    public class Program
    {
        public static void Main()
        {
            Assembly thisAssembly = Assembly.GetExecutingAssembly();
            string loc = thisAssembly.Location;
            loc = Directory.GetParent(loc).FullName;

            string folder = Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit";

            string path = Path.Combine(loc, folder, "Minecraft Topographical Survey.exe");

            try
            {
                ProcessStartInfo start = new ProcessStartInfo(path);
                start.WorkingDirectory = Path.Combine(loc, folder);
                Process.Start(start);
            }
            catch (System.ComponentModel.Win32Exception)
            {
                MessageBox.Show("The MTS executable for your platform could not be found.\n\n" +
                    "Ensure that you extracted all of the files in the MTS download, and that you did not rename any.",
                    "Cannot find MTS " + folder, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
